
/**
 * easyUI  messager
 */
(function ($){
	$.messager.defaults={ok:"确定",cancel:"取消"};
	
	//日期相关
	$.fn.calendar.defaults.weeks = ['日','一','二','三','四','五','六'];
	$.fn.calendar.defaults.months = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'];
	$.fn.datebox.defaults.currentText = "今天";
	$.fn.datebox.defaults.closeText = "关闭";
	$.fn.datebox.defaults.okText = "确定";
	$.fn.datebox.defaults.formatter = function(date){
		if("undefined" == typeof date || date == null){
			return "";
		}
		var y = date.getFullYear();
		var m = date.getMonth()+1;
		var mm = m>9?m:('0'+m);
		var d = date.getDate();
		var dd = d>9?d:('0'+d);
		return y+'-'+mm+'-'+dd;
	}
	
	$.fn.extend({
		pmsLoad : function(url, data, complete) {//load
			if(complete){
				return $(this).load(urlWrapper(url), data, complete);
				
			}else{
				return $(this).load(urlWrapper(url), data);
			}
		}
	});
	
	$.extend({		
		pmsAjax : function(settings) {
			var async = true;
			var loading = true;
			if(settings.loading){
				loading = settings.loading;
			}
			if(settings.async){
				async = settings.async;
			}
			var dataParam ={};
			if(settings.data){
				$.extend(dataParam,settings.data);
			}
			var message = "数据加载中，请稍后……";
			if(settings.message){
				message = settings.message;
			}
			$.ajax({
			  url: settings.url,
			  dataType : 'json',
			  async : async,
			  data:dataParam,
			  type : "POST",
			  beforeSend: function ( xhr ) {
				  if(loading){
					  if(settings.id){
						  $("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo($("#"+settings.id));
						  var msg=$("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(""+message+"").appendTo($("#"+settings.id));
						  msg.css("marginLeft",-msg.outerWidth()/2);
					  }else{
						  $("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo($("body"));
						  var msg=$("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(""+message+"").appendTo($("body"));
						  msg.css("marginLeft",-msg.outerWidth()/2);
					  }
				  }
			  },
			  success:function(data){
				  //$.hideAjaxImg("ajaxImg");
				  if(settings.id){
					  $("#"+settings.id).children("div.datagrid-mask-msg").remove();
					  $("#"+settings.id).children("div.datagrid-mask").remove();
				  }else{
					  $("body").children("div.datagrid-mask-msg").remove();
					  $("body").children("div.datagrid-mask").remove();
			  	  }
				  //setTimeout(function(){},1000);
				  if(settings.success){
					  settings.success(data);
				  }
			  },
			  error : function(XMLHttpRequest, textStatus, errorThrown) {
				  $("body").children("div.datagrid-mask-msg").remove();
				  $("body").children("div.datagrid-mask").remove();
				  if(settings.error){
					  settings.error(XMLHttpRequest, textStatus, errorThrown);
				  }
		   	  }
			  
			});
		}
	});
	function urlWrapper(url) {
		if (url) {
			if (!url.contains("?")) {
				return url += '?m=' + Math.random();
			} else {
				url += '&m=' + Math.random();
			}
		}
		return url;
	}
})(jQuery);
/**
 * 分页datagrid
 */

(function ($) {
	
	//给表格 加 编辑方法 
	$.extend($.fn.datagrid.methods, {
        editCell: function(jq,param){
            return jq.each(function(){
                var opts = $(this).datagrid('options');
                var fields = $(this).datagrid('getColumnFields',true).concat($(this).datagrid('getColumnFields'));
                for(var i=0; i<fields.length; i++){
                    var col = $(this).datagrid('getColumnOption', fields[i]);
                    col.editor1 = col.editor;
                    if (fields[i] != param.field){
                        col.editor = null;
                    }
                }
                $(this).datagrid('beginEdit', param.index);
                for(var i=0; i<fields.length; i++){
                    var col = $(this).datagrid('getColumnOption', fields[i]);
                    col.editor = col.editor1;
                }
            });
        }
    });
	
	

	$.extend($.fn.pagination.defaults, {
		'displayMsg':'总计 {total} 项，当前显示 {from} 到 {to} 项',
		'beforePageText':'页'
	});

	var oDataGridSettings = new Array();
	
	$.fn.pDataGrid = function(options) { //定义插件
		return new dataGrid().init($(this), options).build();
	};

	function dataGrid(){
	  return {
		id:"",
		init:function(o,options){
			this.id = o.attr('id');
			oDataGridSettings[this.id] = null;
			var config = {};
			config.id = this.id;
			config.container = o;

			if (options.completeCallback) {// 表格完成回调
				config.completeCallback = options.completeCallback;
			}

			var tablesSettings = {};
			if(options.idField){
				tablesSettings.idField = options.idField;
			}
			
			if(options.toolbar){
				tablesSettings.toolbar = options.toolbar;
			}

			if (options.rowCallback) {// 行回调
				tablesSettings.rowCallback = options.rowCallback;
			}

			if(options.onLoadSuccess){//请求参数
				tablesSettings["onLoadSuccess"] = options.onLoadSuccess;
			}else{
				tablesSettings["onLoadSuccess"] = function(data){//表格成功加载
					if (config.completeCallback) {// 表格完成回调
						config.completeCallback(data);
					}
				};
			}
			
			if (options.onDblClickRow) {// 行双击事件
				tablesSettings.onDblClickRow = options.onDblClickRow;
			}

			if (options.onClickRow) {// 行单击事件
				tablesSettings.onClickRow = options.onClickRow;
			}			
			
			if(options.rowStyler){//行样式
				tablesSettings.rowStyler = options.rowStyler;
			}

			
			//是否自动加载
			if(options.autoLoad == false){
				if (options.url){//请求URL
					tablesSettings.loadUrl = options.url;
				}
				tablesSettings.autoLoad = false;
			}else{
				if (options.url){//请求URL
					tablesSettings.url = options.url;
				}
				tablesSettings.autoLoad = true;
			}
			
			if(options.fit == false){
				tablesSettings["fit"]= false;   
			}else{
				tablesSettings["fit"]= true;  
			}

			if(options.rownumbers == false){
				tablesSettings["rownumbers"] = false;
			}else{
				tablesSettings["rownumbers"] = true;
			}
			  

			//载入提示
			if(options.loadMsg){ 
				tablesSettings["loadMsg"] = options.loadMsg;
			}else{
				tablesSettings["loadMsg"] = "数据加载中，请稍后……";
			}
			//是否在一行显示数据，否
			if(options.nowrap){ 
				tablesSettings["nowrap"] = options.nowrap;
			}else{
				tablesSettings["nowrap"]= false; 
			}
			if(options.remoteFilter){ 
				tablesSettings["remoteFilter"] = options.remoteFilter;
			}
			if(options.enableFilter){ 
				tablesSettings.enableFilter = options.enableFilter;
			} 
			tablesSettings["iconCls"] = "icon-edit";  //图表
			
			tablesSettings["striped"]= true;  //显示行的条纹
			tablesSettings["border"]= true;   //显示边框
			tablesSettings["resizable"]= false;   //列宽不能调整
			tablesSettings["remoteSort"]= false;   //设置不能远程排序
			tablesSettings["columns"] = options.columns;//表格列信息
			tablesSettings["method"]= "post";   //请求方式
			tablesSettings["checkOnSelect"]= false; 
			 
			tablesSettings["fitColumns"]= true;    
			tablesSettings["autoRowHeight"] = true;

			if(options.collapsible){//请求参数
				tablesSettings["collapsible"] = options.collapsible;
			}else{
				tablesSettings["collapsible"] = false;
			}
			if(options.checkOnSelect){//单击选中行 主要是checkbox
				tablesSettings["checkOnSelect"] = options.checkOnSelect;
			}else{
				tablesSettings["checkOnSelect"] = false;
			}

			if(options.queryParams){//请求参数
				tablesSettings["queryParams"] = options.queryParams;
			}else{
				tablesSettings["queryParams"] = {};
			}
			
			if(options.title){//标题
				tablesSettings.title = options.title;
			}
			
			if("undefined" != typeof options.singleSelect){//是否单选
				tablesSettings.singleSelect = options.singleSelect;
			}else{
				tablesSettings.singleSelect = true;
			}
			

			if(options.pageList){//分页pageSize列表
				tablesSettings.pageList = options.pageList;
			}else{
				tablesSettings.pageList = [10,30,50,80,100,500,1000];
			}
			
			if(options.pageSize){//分页pageSize
				tablesSettings.pageSize = options.pageSize;
			}else{
				tablesSettings.pageSize = '100';
			}

			if("undefined" != typeof options.pagination && options.pagination == false){//是否分页，不填默认分页
				tablesSettings.pagination = options.pagination;
				tablesSettings.queryParams.pageable = 'false';
			}else{
				tablesSettings.pagination = true;
				tablesSettings.queryParams.pageable = 'true';
			}

			if(options.width){//表格长度
				tablesSettings.width = options.width;
			}else{
				tablesSettings.width = 'auto';
			}

			if(options.height){//表格宽度
				tablesSettings.height = options.height;
			}else{
				tablesSettings.height = 'auto';
			}
			if (options.view) { 
				tablesSettings.view = options.view;
			}
			if (options.detailFormatter) { 
				tablesSettings.detailFormatter = options.detailFormatter;
			}
			if (options.onExpandRow) { 
				tablesSettings.onExpandRow = options.onExpandRow;
			}
			if (options.onClickCell) { 
				tablesSettings.onClickCell = options.onClickCell;
			}
			$.extend(tablesSettings,options);
			config.settings = tablesSettings;
			oDataGridSettings[this.id] = config;
			return this;

		},
		build:function(){
			var config = oDataGridSettings[this.id];
			if(config.datagrid == null){
				config.datagrid = config.container.datagrid(config.settings);
				oDataGridSettings[this.id] = config;
			}
			return this;
		},
		getCheckedData:function(){
			return $('#'+this.id).datagrid('getChecked');
		},
		getSelectedData:function(){
			return $('#'+this.id).datagrid('getSelections');
		},
		getDatas:function(){
			return $('#'+this.id).datagrid('getData');
		},
		datagrid:function(opt,param){
			return $('#'+this.id).datagrid(opt,param);
		},
		updateRow : function(rowRecord, index) {// 更新行
			var param = {};
			param.index = index;
			param.row = rowRecord;			
			$('#'+this.id).datagrid('updateRow',param);
		},
		insertRow : function(rowRecord,index) {// 添加行
			var param = {};
			if(index){
				param.index = index;
			}
			param.row = rowRecord;
			$('#'+this.id).datagrid('insertRow',param);
		},
		removeRow : function(index) {// 移除行
			if (index && index >= 0) {
				$('#'+this.id).datagrid('deleteRow',index);
			}
		},
		removeAllRows : function() {// 删除所有数据
			var rows = $('#'+this.id).datagrid('getRows');
			var size = rows.length;
			for ( var i = 0; i < size; i++) {
				$('#'+this.id).datagrid('deleteRow',0);
			}
		},
		addQueryParams:function(param){
			var config = oDataGridSettings[this.id];
			var obj = {};
			if(config.settings.autoLoad == false){
				$.extend(obj,{url:config.settings.loadUrl});
			}
			
			$.extend(config.settings.queryParams,param);
		},
		getQueryParams:function(){
			var config = oDataGridSettings[this.id];
			return config.settings.queryParams;
		},
		refresh:function(param){
			var config = oDataGridSettings[this.id];
			var obj = {};
			if(config.settings.autoLoad == false){
				$.extend(obj,{url:config.settings.loadUrl});
			}
			
			$.extend(param,{"pageable":config.settings.queryParams.pageable});
			$.extend(obj,{queryParams:param});
			$('#'+this.id).datagrid(obj);
			return this;
		},
		
		filter:function(param){
			$('#'+this.id).datagrid('enableFilter',param);
			//$.extend(extendedOptions,{tableGrid:this});
		}
	  };
	}
})(jQuery);

/**
 * tabs
 */
(function($){
	
	var pTabsConfigs = new Array(); 
	$.fn.pTabs = function(options){
		return new tabs().init($(this),options).build();
	}
	
	function tabs(){
		return {
			id:"",
			init:function(o,options){
				this.id = o.attr('id');
				pTabsConfigs[this.id] = null;
				var config = {};
				config.id = this.id;
				config.container = o;
				
				var tabsSettings = {};
				//tabs长度
				if(options.width){
					tabsSettings.width = options.width;
				}
				
				//tabs高度
				if(options.height){
					tabsSettings.height = options.height;
				}else{
					tabsSettings.height = '500px';
				}
				
				if(options.border){
					tabsSettings.border = options.border;
				}else{
					tabsSettings.border = true;
				}
				
				if(options.plain){
					tabsSettings.plain = options.plain;
				}else{
					tabsSettings.plain = true;
				}
				
				//tabs滚动个数
				if(options.scrollIncrement){
					tabsSettings.scrollIncrement = options.scrollIncrement;
				}
				
				if(options.tools){
					tabsSettings.tools = options.tools;
				}
				
				//工具的位置，默认‘right’
				if(options.toolPosition){
					tabsSettings.toolPosition = options.toolPosition;
				}
				
				//标签的位置，默认是‘top’
				if(options.tabPosition){
					tabsSettings.tabPosition = options.tabPosition;
				}
				
				//tab标签的长度
				if(options.tabWidth){
					tabsSettings.tabWidth = options.tabWidth;
				}
				
				//tab标签的高度
				if(options.tabHeight){
					tabsSettings.tabHeight = options.tabHeight;
				}
				
				//子标签的数组
				if(options.tabs){
					config.tabs = options.tabs;
				}
				
				if(options.onSelect){
					tabsSettings.onSelect = options.onSelect;
				}
				if(options.view){
					tabsSettings.view = options.view;
				}
				
				tabsSettings.fit = true;
				
				config.setting = tabsSettings;
				pTabsConfigs[this.id] = config;
				return this;
			},
			build:function(){
				var config = pTabsConfigs[this.id];
				
				if(null == config.ptabs){
					config.ptabs = $("#"+this.id).tabs(config.setting);
					pTabsConfigs[this.id] = config;
				}
				return this;
			},
			addTab:function(params){
				if(!$("#"+this.id).tabs('exists',params.title)){
					if(typeof(params.cache)=='undefined'){
						params.cache = false;
					}
					
					$("#"+this.id).tabs('add',params);
				}else{
					if(typeof(params.cache)=='undefined'){
						params.cache = false;
					}
					$("#"+this.id).tabs('close',params.title);
					$("#"+this.id).tabs('add',params);
					
				}
			},
			disableTab:function(which){//which可以是tab的index或者是title
				$("#"+this.id).tabs('disableTab',which);
			},
			enableTab:function(which){
				$("#"+this.id).tabs('enableTab',which);
			}
		}
	}
	
	
})(jQuery);

//dialog
(function ($) {
	
	$.extend({
        pmsDialog: function (options) {
        	var href;
        	if(options.href){
        		href = options.href;
        	}else{
        		return false;
        	}
        	
        	var title;
        	if(options.width){//长度
        		width = options.width;
        	}else{
        		width = window.innerWidth;
        	}
        	var fit;
        	if(options.fit){ 
        		fit = options.fit;
        	}else{
        		fit = false;
        	}
        	
        	var maximizable;
        	if(options.maximizable){
        		maximizable = options.maximizable;
        	}else{
        		maximizable = false;
        	}
        	
        	if(options.height){//高度
        		height = options.height;
        	}else{
        		height = window.innerHeight-50;
        	}
        	if(options.subtractHeight){//高度
        		height = height- options.subtractHeight;
        	} 
        	if(options.title){//标题
        		title = options.title;
        	}else{
        		title = "应用窗口";
        	}
        	var id= "";
        	if(options.id){
	    		id=options.id;
	    	}else{
	    		id= "zcDialog_"+Math.floor(Math.random() * 1000000);
	    	}
        	
        	if(options.params){
        		for(var property in options.params){ 
        			if(href.indexOf("?") != -1){
        				href = href + '&'+property+'='+options.params[property] ;
        			}else{
        				href = href + '?'+property+'='+options.params[property];
        			}
        		}
        	}
        	
    		if(href.indexOf("?") != -1){
    			href = href + '&zcDialog='+id;
			}else{
				href = href + '?zcDialog='+id;
			}
    		var $div;
    		if(options.isIf){
    			if(options.isParent){
    				$div= parent.$('<div id="'+id+'"><iframe src='+href+' scrolling="auto" frameborder="0"  style="width:100%;height:100%;"></iframe></div>');
    			}else{
    				$div= $('<div id="'+id+'"><iframe src='+href+' scrolling="auto" frameborder="0"  style="width:100%;height:100%;"></iframe></div>');
    			}
    			href="";
    		}else{
    			if(options.isParent){
    				  $div = parent.$('<div id="'+id+'"></div>');
    			}else{
    				  $div = $('<div id="'+id+'"></div>');
    			}
    		  
    		}
    		if(options.buttons){
    			$div.dialog({
            		title: title,
        		    width: width,
        		    height: height,
        		    closed: false,
        		    cache: false,
        		    modal: true,
        		    href:href,
        		    buttons:options.buttons,
        		    fit:fit,
        		    maximizable:maximizable,
        		    onClose:function(){
        		    	if(options.close){
        		    		options.close();
        		    	}
        		    	$("#"+id).dialog("destroy");
        		    }
            	});
    		}else{
    			$div.dialog({
            		title: title,
        		    width: width,
        		    height: height,
        		    closed: false,
        		    cache: false,
        		    modal: true,
        		    href:href,
        		    fit:fit,
        		    maximizable:maximizable,
        		    onClose:function(){
        		    	if(options.close){
        		    		options.close();
        		    	}
        		    	$("#"+id).dialog("destroy");
        		    }
            	});
    		}
			
    		
        }
    });
	
	/**
	 * auther by zxj
	 * 验证扩展
	 * date : 2013 - 10 -09
	 */
	$.extend($.fn.validatebox.defaults.rules, {
		minLength : { // 判断最小长度
			validator : function(value, param) {
				return value.length >= param[0];
			},
			message : '最少输入 {0} 个字符。'
		},
		length:{validator:function(value,param){
			//var len=$.trim(value).length;
			var len =0;
			for(var i = 0;i<value.length;i++){
				var c = value.charCodeAt(i);
				if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)){
					len++;
				}else{
					len+=3;
				}
			}
				return len>=param[0]&&len<=param[1];
			},
				message:"内容长度介于{0}和{1}之间."
			},
		phone : {// 验证电话号码
			validator : function(value) {
				return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/i.test(value);
			},
			message : '格式不正确,请使用下面格式:020-88888888'
		},
		mobile : {// 验证手机号码
			validator : function(value) {
				return /^(13|15|18)\d{9}$/i.test(value);
			},
			message : '手机号码格式不正确(正确格式如：13450774432)'
		},
		phoneOrMobile:{//验证手机或电话
			validator : function(value) {
				return /^(13|15|18)\d{9}$/i.test(value) || /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/i.test(value);
			},
			message:'请填入手机或电话号码,如13688888888或020-8888888'
		},
		idcard : {// 验证身份证
			validator : function(value) {
				return /^\d{15}(\d{2}[A-Za-z0-9])?$/i.test(value);
			},
			message : '身份证号码格式不正确'
		},
		floatOrInt : {// 验证是否为小数或整数
			validator : function(value) {
				return /^(\d{1,3}(,\d\d\d)*(\.\d{1,3}(,\d\d\d)*)?|\d+(\.\d+))?$/i.test(value);
			},
			message : '请输入数字，并保证格式正确'
		},
		currency : {// 验证货币
			validator : function(value) {
				return /^d{0,}(\.\d+)?$/i.test(value);
			},
			message : '货币格式不正确'
		},
		qq : {// 验证QQ,从10000开始
			validator : function(value) {
				return /^[1-9]\d{4,9}$/i.test(value);
			},
			message : 'QQ号码格式不正确(正确如：453384319)'
		},
		integer : {// 验证整数
			validator : function(value) {
				return /^[+]?[1-9]+\d*$/i.test(value);
			},
			message : '请输入整数'
		},
		numberOrLength : {//验证数字或长度
			validator : function(value,param){
				var len=$.trim(value).length;
				return  /^[+]?[1-9]+\d*$/i.test(value) && len>=param[0]&&len<=param[1];
			},
			message : '请输入长度介于0和{1}之间的数字'
		},
		chinese : {// 验证中文
			validator : function(value) {
				return /^[\u0391-\uFFE5]+$/i.test(value);
			},
			message : '请输入中文'
		},
		english : {// 验证英语
			validator : function(value) {
				return /^[A-Za-z]+$/i.test(value);
			},
			message : '请输入英文'
		},
		unnormal : {// 验证是否包含空格和非法字符
			validator : function(value) {
				return /.+/i.test(value);
			},
			message : '输入值不能为空和包含其他非法字符'
		},
		username : {// 验证用户名
			validator : function(value) {
				return /^[a-zA-Z][a-zA-Z0-9_]{5,15}$/i.test(value);
			},
			message : '用户名不合法（字母开头，允许6-16字节，允许字母数字下划线）'
		},
		faxno : {// 验证传真
			validator : function(value) {
//				return /^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/i.test(value);
				return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/i.test(value);
			},
			message : '传真号码不正确'
		},
		zip : {// 验证邮政编码
			validator : function(value) {
				return /^[1-9]\d{5}$/i.test(value);
			},
			message : '邮政编码格式不正确'
		},
		ip : {// 验证IP地址
			validator : function(value) {
				return /d+.d+.d+.d+/i.test(value);
			},
			message : 'IP地址格式不正确'
		},
		name : {// 验证姓名，可以是中文或英文
				validator : function(value) {
					return /^[\u0391-\uFFE5]+$/i.test(value)|/^\w+[\w\s]+\w+$/i.test(value);
				},
				message : '请输入姓名'
		},
		carNo:{
			validator : function(value){
				return /^[\u4E00-\u9FA5][\da-zA-Z]{6}$/.test(value); 
			},
			message : '车牌号码无效（例：粤J12350）'
		},
		carenergin:{
			validator : function(value){
				return /^[a-zA-Z0-9]{16}$/.test(value); 
			},
			message : '发动机型号无效(例：FG6H012345654584)'
		},
		email:{
			validator : function(value){
			return /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(value); 
		},
		message : '请输入有效的电子邮件账号(例：abc@126.com)'	
		},
		msn:{
			validator : function(value){
			return /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(value); 
		},
		message : '请输入有效的msn账号(例：abc@hotnail(msn/live).com)'
		},department:{
			validator : function(value){
				return /^[0-9]*$/.test(value); 
			},
			message : '请输入部门排序号(例：1)'	
		},same:{
			validator : function(value, param){
				if($("#"+param[0]).val() != "" && value != ""){
					return $("#"+param[0]).val() == value; 
				}else{
					return true;
				}
			},
			message : '两次输入的密码不一致！'	
		},
		
		largerThan:{// 验证大于前一个数字
			validator : function(value,param) {
				if($("#"+param[0]).val() != "" && value != ""){
					return Number($("#"+param[0]).val()) < Number(value); 
				}else{
					return true;
				}
			},
			message : '请输入大于前一个数字的数字'
		}
	});
	
	
	
	
})(jQuery);
var parser;
(function($){  
    parser = {  
        auto: true,  
        plugins:['linkbutton','menu','menubutton','splitbutton','layout',  
                 'tree','window','dialog','datagrid',  
                 'combobox','combotree','numberbox','validatebox',  
                 'calendar','datebox','panel','tabs','accordion'  
        ],  
        parse: function(context){  
            if ($.parser.auto){  
                for(var i=0; i<$.parser.plugins.length; i++){  
                    (function(){  
                        var name = $.parser.plugins[i];  
                        var r = $('.easyui-' + name, context);  
                        if (r.length){  
                            if (r[name]){  
                                r[name]();  
                            } else if (window.easyloader){  
                                easyloader.load(name, function(){  
                                    r[name]();  
                                })  
                            }  
                        }  
                    })();  
                }  
            }  
        }  
    };  
})(jQuery);

